﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace StoreWeb.system.memberManage
{
    public partial class sizeTemplateDetailByMember : System.Web.UI.Page
    {
        //BLL.Role role = new BLL.Role();
        Maticsoft.BLL.membersize membersizebll = new Maticsoft.BLL.membersize();
        public string sizetemplateDetailstr = "";
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                Bind();
                hidid.Value = Request.QueryString["id"];
                id.Value = hidid.Value;
                

                int counts = membersizebll.GetModelList(string.Format("membercode='{0}'", hidid.Value)).Count;
                if (counts > 0){
                    size.Value = membersizebll.GetModelList(string.Format("membercode='{0}'", hidid.Value))[0].size;
                    List<Maticsoft.Model.membersize> sizeTemplateDetails = membersizebll.GetModelList(string.Format("membercode='{0}'", hidid.Value));
                    for (int i = 0; i < sizeTemplateDetails.Count; i++)
                    {
                        sizetemplateDetailstr += "<tr class=\"body\">";
                        sizetemplateDetailstr += "<td><input class=\"name\" type=\"text\" value=\"" + sizeTemplateDetails[i].name + "\"   name=\"name\"></td>";
                        sizetemplateDetailstr += "<td>";
                        sizetemplateDetailstr += "<span class=\"button minus\"></span>";
                        sizetemplateDetailstr += "<input class=\"number\" type=\"text\" value=\"" + sizeTemplateDetails[i].value + "\"    name=\"value\">";
                        sizetemplateDetailstr += "<span class=\"button plus\"></span>";
                        sizetemplateDetailstr += "</td>";
                        sizetemplateDetailstr += "<td><a class=\"del\" href=\"javascript:;\">删除</a></td>";
                        sizetemplateDetailstr += "</tr>";
                    }
                }
                else {
                    sizetemplateDetailstr = "";
                }


            }
        }

        private void Bind()
        {
            BLL.sizeTemplate message = new BLL.sizeTemplate();
            select.DataSource = message.GetList(" ");
            select.DataTextField = "name";
            select.DataValueField = "id";
            select.DataBind();
            select.Items.Insert(0, new ListItem { Value = "", Text = "------可选模板------" });

        }
    }
}